#ifndef __TASK_QUEUE_HH__
#define __TASK_QUEUE_HH__

#include <iostream>
#include <queue>
#include <mutex>
#include <condition_variable>
#include <functional>

using std::queue;
using std::mutex;
using std::condition_variable;
using std::unique_lock;
using std::bind;
using std::function;


class TaskQueue
{
    using Task = function<void()>;
public:
    TaskQueue(size_t capacity);
    ~TaskQueue();
    void push(Task&& task);
    Task pop();
    bool empty();
    bool full();
    void setExit(bool status);
private:
    bool _if_exit;
private:
    size_t _capacity;
    queue<Task> _queue;
    mutex _mutex;
    condition_variable _notfull;
    condition_variable _notempty;
};


#endif